package org.rabbitmq.rabbitextensions.listener;

import com.rabbitmq.client.Channel;
import org.rabbitmq.rabbitextensions.constant.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Date;

//@Component
public class DelayListener {
    /**
     * 延迟队列
     * @param message
     * @param channel
     * @throws IOException
     */
    @RabbitListener(queues = Constants.DELAY_QUEUE)
    public void handlerMessage(Message message, Channel channel) throws IOException {
        System.out.printf("%tc ,[delay]收到消息:%s ",new Date(),new String(message.getBody(),"UTF-8"));
    }
}
